package com.smh.hmdianping.config;

import com.smh.hmdianping.interceptor.LoginInterceptor;
import com.smh.hmdianping.interceptor.RefreshInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author shiminghui
 * @date 2025/3/27 15:45
 * @description: TODO
 */
@Configuration
@Slf4j
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;
    @Autowired
    private RefreshInterceptor refreshInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/user/**");
        registry.addInterceptor(refreshInterceptor)
                .addPathPatterns("/**");
        log.info("拦截器加载成功");
    }
}
